package org.springblade.common.utils.mq;

import com.github.thierrysquirrel.annotation.CommonMessage;
import com.github.thierrysquirrel.annotation.RocketMessage;
import com.github.thierrysquirrel.annotation.StartDeliverTime;
import com.github.thierrysquirrel.core.producer.MessageSendType;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;

/**
 * User: Jackey
 * Date: 2022/05/09
 * Time: 下午2:15
 * Description: 报障延迟队列发送
 */

@Slf4j
@Component
@RocketMessage(groupID = "GID_delayed")
public class AlarmSend {

	/**
	 * 报障生产延迟消息到MQ
	 * @param startDeliverTime 时间戳(毫秒),不能小于当前时间
	 * @param message 消息体
	 * @return
	 */
    @CommonMessage(topic = "delayed", tag = "alarm",messageSendType = MessageSendType.SEND)
    public String sendAlarmDelayed(@StartDeliverTime long startDeliverTime, String message) {
        log.info("===============延时队列生产消息[{}]====================",startDeliverTime);
        log.info("发送时间:[{}],发送内容:[{}]", LocalDateTime.now(), message);
        return message;
    }

	/**
	 * 维修/配件工单生产签退延迟消息到MQ
	 * @param startDeliverTime
	 * @param message
	 * @return
	 */
	@CommonMessage(topic = "delayed", tag = "sign_out",messageSendType = MessageSendType.SEND)
    public String sendWxPartsPlanSignOutDelayed(@StartDeliverTime long startDeliverTime, String message) {
		log.info("===============延时队列生产签退消息[{}]====================",startDeliverTime);
		log.info("发送时间:[{}],发送内容:[{}]", LocalDateTime.now(), message);
		return message;
	}


}
